package com.tuozixuan.lang3.builder;

import org.apache.commons.lang3.builder.DiffBuilder;
import org.apache.commons.lang3.builder.DiffResult;
import org.apache.commons.lang3.builder.Diffable;
import org.apache.commons.lang3.builder.ToStringStyle;

public class Person implements Diffable<Person> {
	
	private String name;
	private int age;
	private boolean smoker;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public boolean isSmoker() {
		return smoker;
	}

	public void setSmoker(boolean smoker) {
		this.smoker = smoker;
	}
	
	@Override
	public DiffResult<Person> diff(Person obj) {
		return new DiffBuilder<Person>(this, obj, ToStringStyle.SHORT_PREFIX_STYLE)
				.append("name", this.name, obj.name)
				.append("age", this.age, obj.age)
				.append("smoker", this.smoker, obj.smoker).build();
	}

}
